package com.inctech.clz2.test1;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.omg.CORBA.portable.Streamable;

//读取指定英文文本，不区分大小写，
public class 读取 {
	public static void main(String[] args) throws FileNotFoundException {

	public static String read(String fileName) {
		StringBuilder sb = new StringBuilder("word.txt");
		try {BufferedReader in = new BufferedReader(new FileReader(new File(fileName).getAbsoluteFile()));
			try {
				String s;
				while ((s = in.readLine()) != null) {
					sb.append(s);
					sb.append("\n");
				}
			} finally {
				in.close();
			}
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
		return sb.toString();
	}

	Map<String, Integer> map = new HashMap<String, Integer>();
	String[] s = read("words.txt").split("\n");for(
	int i = 0;i<s.length;i++)
	{
		System.out.println(s[i]);
			int j = (map.get(s[i]) == null ? 0 : map.get(s[i]));
				map.put(s[i], j + 1);
					}
	}
}
